//-----------------------------------------------------------------------
// <copyright file="OnlineService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class OnlineService
    {
        #region Online

        public static void CreateOnline(Online online)
        {            
            try
            {
                OnlineDAO onlineDAO = new OnlineDAO();
                onlineDAO.CreateOnline(online);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateOnlineException, ex);
            }
        }        

        public static void UpdateOnline(Online online)
        {            
            try
            {
                OnlineDAO onlineDAO = new OnlineDAO();
                onlineDAO.UpdateOnline(online);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateOnlineException, ex);
            }
        }        

        public static void DeleteOnline(long onlineId)
        {            
            try
            {
                OnlineDAO onlineDAO = new OnlineDAO();
                onlineDAO.DeleteOnline(onlineId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteOnlineException, ex);
            }
        }
        
        public static Online GetOnline(long onlineId)
        {            
            try
            {
                OnlineDAO onlineDAO = new OnlineDAO();
                return onlineDAO.GetOnline(onlineId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetOnlineException, ex);
            }
        }                

        public static OnlineCollection GetOnlineList(OnlineColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                OnlineDAO onlineDAO = new OnlineDAO();
                return onlineDAO.GetOnlineList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetOnlineListException, ex);
            }
        }        

        public static OnlineCollection GetOnlineList(OnlineColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                OnlineDAO onlineDAO = new OnlineDAO();
                return onlineDAO.GetOnlineList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetOnlineListException, ex);
            }
        }        

	    public static OnlineCollection GetOnlineListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                OnlineDAO onlineDAO = new OnlineDAO();
                return onlineDAO.GetOnlineListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetOnlineListException, ex);
            }
        }        

        public static OnlineCollection GetOnlineListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                OnlineDAO onlineDAO = new OnlineDAO();
                return onlineDAO.GetOnlineListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetOnlineListException, ex);
            }
        }        

        #endregion
    }
}